package com.xu.mylol.acyivity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;

import com.xu.mylol.R;

/**
 * Created by dllo on 16/1/12.
 */
public class StartingActivity extends AppCompatActivity{
    private ImageView imageView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_starting);
        imageView = (ImageView) findViewById(R.id.starting_iv);
        final Handler handler =new Handler(new Handler.Callback() {
            @Override
            public boolean handleMessage(Message msg) {
                Intent intent = new Intent(StartingActivity.this,MainActivity.class);
                startActivity(intent);
                finish();
                return false;
                }
        });

        new Thread(new Runnable() {
            @Override
            public void run() {
                 try {
                     Thread.sleep(5000);
                     handler.sendEmptyMessage(0);
                     } catch (InterruptedException e) {
                     e.printStackTrace();
                 }
            }
        }).start();
    }


}
